﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Headlight.Controllers.Wizard
{
    public class Step
    {
        public Step(int number, ViewType viewType) { Number = number; ViewType = viewType; }
        public int Number { get; set; }
        public ViewType ViewType { get; set; }
        public string ViewName { get { return this.ViewType.ToString(); } }
        public bool Completed { get; set; }
    }

    public class WizardBuilder
    {
        private int _currentStepNumber = 1;
        private IPath _path;

        public WizardBuilder(PathType pathType)
        {
            _path = PathFactory.CreatePath(pathType);
        }

        public Step NextStep()
        {
            CurrentStep().Completed = true;
            _currentStepNumber++;
            return _path.Steps.Single(s => s.Number == _currentStepNumber);
        }

        public Step PreviousStep()
        {
            _currentStepNumber--;
            return _path.Steps.Single(s => s.Number == _currentStepNumber);
        }

        public Step CurrentStep()
        {
            return _path.Steps.Single(s => s.Number == _currentStepNumber); 
        }
    }
}
